<?php

require_once 'common/conn.php';
$result = array();
if (isset($_GET['usercode'])) {
    $usercode = $_GET['usercode'];
}

if (isset($_GET['property'])) {
    $property = $_GET['property'];
}

if (isset($_GET['number'])) {
    $number = $_GET['number'];
} else {
    $number = 1;
}

if (isset($_GET['type'])) {
    $type = $_GET['type']; // type= property || avatar
}

$db = new DBC();
$result['errorNo'] = 0;
if (isset($number) && isset($usercode) && isset($type)) {
    $sql = "INSERT INTO t_hibaby_property_record(usercode,property,type,number,createTime) VALUES('"
            . $usercode . "','" . $property . "','" . $type . "'," . $number . ",now())";
    if ($db->execute($sql)) {
        $result['errorNo'] = "0";
        $result['errorMsg'] = "";
    } else {
        $result['errorNo'] = "1";
        $result['errorMsg'] = "更新道具记录错误";
    }
} else {
    $result['errorNo'] = "2";
    $result['errorMsg'] = "提交参数不完整";
}
echo json_encode($result);
?>
